from sort.Sort import Sort


class InsertSort(Sort):
    def __init__(self):
        super().__init__()

    def sort(self, arr_list):
        length = len(arr_list)
        for i in range(1, length):
            temp = arr_list[i]
            for j in range(i - 1, -1, -1):
                if arr_list[j] > temp:
                    arr_list[j + 1] = arr_list[j]
                    if j == 0:
                        arr_list[0] = temp
                else:
                    arr_list[j + 1] = temp
                    break

        return arr_list


if __name__ == '__main__':
    arr = [2, 5, 3, 7, 1, 4]
    print(arr)
    sort = InsertSort()
    print(sort.sort(arr))
